/* A vertex shader that assigns this vertex's
   texture coordinate attribute to a varying
   attribute that is interpolated for fragments.
*/

attribute vec2 vertex_texture_coordinate;

varying float intensity;
varying vec2 fragment_texture_coordinate;
varying vec3 LightDir;
varying vec4 passcolor;

void main(void)
{
	/* we still need to assign a position and color for 
 	   the vertex.  By overriding the standard GL pipeline,
 	   GL no longer does this for us by default. 
	*/

	gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
	gl_FrontColor = gl_Color;
	passcolor = gl_Color;
	fragment_texture_coordinate = vertex_texture_coordinate;

	vec3 n = normalize(gl_NormalMatrix*gl_Normal);
	vec3 vVertex = vec3(gl_ModelViewMatrix*gl_Vertex);
	vec3 tmpVec = gl_LightSource[0].position.xyz - vVertex;
	tmpVec = normalize(tmpVec);
	LightDir = tmpVec;
}

